home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML Instance.sea / XML Instance / Required / plugins / HTMLWindow.jar / horst / IFrameView.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-03-18  |  3.4 KB  |  66 lines

  1. package horst;
  2.  
  3. import java.awt.Rectangle;
  4. import java.net.URL;
  5.  
  6. public class IFrameView extends ComponentView {
  7.    int m_width;
  8.    int m_height;
  9.  
  10.    public IFrameView(View parent, Element e, HTMLPane container) {
  11.       super(parent, e, container);
  12.    }
  13.  
  14.    protected int getMinimumSpan(int axis) {
  15.       return this.getPreferredSpan(axis);
  16.    }
  17.  
  18.    protected int getPreferredSpan(int axis) {
  19.       switch (axis) {
  20.          case 0:
  21.             return this.m_height;
  22.          case 1:
  23.             return this.m_width;
  24.          default:
  25.             return 100;
  26.       }
  27.    }
  28.  
  29.    protected void init() {
  30.       int frameBorder = Utilities.setIntegerProperty(1, "frameborder", super.m_elem.getAttributes());
  31.       boolean bScrolling = Utilities.setBooleanProperty(true, "scrolling", super.m_elem.getAttributes());
  32.       HTMLWindow htmlWnd = new HTMLWindow(frameBorder != 1);
  33.       HTMLPane renderer = htmlWnd.getHTMLPane();
  34.       renderer.m_preferences.m_bShowToolTip = false;
  35.       renderer.m_props.m_bIsIFrame = true;
  36.       int marginWidth = Utilities.setIntegerProperty(super.m_container.m_props.m_marginWidth, "marginwidth", super.m_elem.getAttributes());
  37.       int marginHeight = Utilities.setIntegerProperty(super.m_container.m_props.m_marginWidth, "marginheight", super.m_elem.getAttributes());
  38.       renderer.setMargins(marginWidth, marginHeight);
  39.       super.m_comp = htmlWnd;
  40.       super.m_container.add(super.m_comp);
  41.       URL u = Utilities.setURLProperty(super.m_elem.getDocument().getBaseURL(), "src", super.m_elem.getAttributes());
  42.       if (u != null) {
  43.          renderer.openPage(u);
  44.       }
  45.  
  46.       super.m_alignment = Utilities.setAlignmentProperty(false, 0, "align", super.m_elem.getAttributes());
  47.       this.m_width = Utilities.setIntegerProperty(100, "width", super.m_elem.getAttributes());
  48.       this.m_height = Utilities.setIntegerProperty(100, "height", super.m_elem.getAttributes());
  49.    }
  50.  
  51.    protected boolean isFloater() {
  52.       String align = (String)super.m_elem.getAttribute("align");
  53.       if (align == null) {
  54.          return false;
  55.       } else {
  56.          return align.equalsIgnoreCase("left") || align.equalsIgnoreCase("right");
  57.       }
  58.    }
  59.  
  60.    protected Rectangle layout(int x, int y, int width, LayoutInfo info) {
  61.       super.m_bounds.setBounds(x, y, this.getPreferredSpan(1), this.getPreferredSpan(0));
  62.       super.m_comp.setBounds(super.m_bounds);
  63.       return super.m_bounds;
  64.    }
  65. }
  66.